package com.cooldatasoft.domain.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cooldatasoft.domain.dao.DocumentEntryDao;
import com.cooldatasoft.domain.model.Document;
import com.cooldatasoft.domain.model.DocumentEntry;
import com.cooldatasoft.domain.service.DocumentEntryService;

@Service("documentEntryService")
public class DocumentEntryServiceImpl implements DocumentEntryService {

	@Autowired
	private DocumentEntryDao documentEntryDao;

	@Override
	public Long insertDocumentEntry(DocumentEntry docEntry) {
		return documentEntryDao.insert(docEntry);
	}

	@Override
	public void updateDocumentEntry(DocumentEntry docEntry) {
		documentEntryDao.update(docEntry);
	}

	@Override
	public void deleteDocumentEntry(DocumentEntry entry) {	
		documentEntryDao.delete(entry.getId());
	}

	@Override
	public List<DocumentEntry> getAllDocumentEntries() {
		return documentEntryDao.getAll();
	}

	@Override
	public DocumentEntry getById(Long id) {
		return documentEntryDao.getById(id);
	}

	@Override
	public List<DocumentEntry> getByDocument(Document document) {
		return documentEntryDao.getByDocument(document);
	}
}
